<template>
	<view>

		<view class="top">
			<view class="title">主页</view>

			<view class="user">

				<view class="circle-logo">
					<image src="../../../static/msj/图层 3.png" class="logo-image"></image>
				</view>

				<view class="welcome">大美修车厂,欢迎您</view>
			</view>

			<view class="subnav">
				<view class="subnav-item" @click="goToSmhx">
					<view class="icon-wrapper">
						<image src="../../../static/msj/扫码.png" class="icon"></image>
					</view>
					<view class="text">扫码核销</view>
				</view>
				<view class="divider"></view>
				<view class="subnav-item" @click="goToSrhx">
					<view class="icon-wrapper">
						<image src="../../../static/msj/输入2.png" class="icon"></image>
					</view>
					<view class="text">输入核销码</view>
				</view>
			</view>

		</view>

		<view class="body">
			<u-grid :border="false" col="4">
				<u-grid-item v-for="(listItem, listIndex) in list" :key="listIndex">
					<view class="grid-item" @click="navigateToPage(listItem)">
						<image :src="listItem.url" class="icon"></image>
						<text class="grid-text">{{listItem.title}}</text>
					</view>
				</u-grid-item>
			</u-grid>
			<u-toast ref="uToast" />
		</view>


		<view class="bottom">
			<view class="notification-header">
				<view class="left">
					<image src="../../../static/msj/消息-信息.png" class="notification-icon"></image>
					<text class="notification-text">最新通知</text>
				</view>
				<view class="right">
					<text class="task-text">今日需上门取车任务共32单</text>
					<image src="../../../static/msj/收起箭头小.png" class="arrow-icon"></image>
				</view>
			</view>

			<view class="task-table">
				<view class="table-header">
					<text class="table-header-item">用户</text>
					<text class="table-header-item">服务项目</text>
					<text class="table-header-item">时间</text>
				</view>
				<view class="table-row" v-for="(task, index) in tasks" :key="index">
					<text class="table-row-item">{{task.user}}</text>
					<text class="table-row-item">{{task.service}}</text>
					<text class="table-row-item">{{task.time}}</text>

				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						url: '../../../static/msj/统计.png',
						title: '经营统计',
						page: '/pages/msj/operating/operating'
					},
					{
						url: '../../../static/msj/统计.png',
						title: '核销记录',
						page: '/pages/msj/cancel/cancel'
					},
					{
						url: '../../../static/msj/123收支明细.png',
						title: '收支明细',
						page: '/pages/inout/inout'
					},
					{
						url: '../../../static/msj/订单管理.png',
						title: '订单管理',
						page: '/pages/order/order'
					},
					{
						url: '../../../static/msj/卡券.png',
						title: '卡券管理'
					},
					{
						url: '../../../static/msj/维修.png',
						title: '维修任务',
						page: '/pages/maintain/maintain'
					},
					{
						url: '../../../static/msj/评价管理.png',
						title: '评价管理'
					},
					{
						url: '../../../static/msj/资料库.png',
						title: '商户资料'
					},
					{
						url: '../../../static/msj/活动.png',
						title: '活动发布'
					},
				],
				tasks: [{
						user: '张先生',
						service: '汽车美容,基础保养',
						time: '2024-12-06 10:00'
					},
					{
						user: '张先生',
						service: '汽车精洗',
						time: '2024-12-06 11:00'
					},
					{
						user: '张先生',
						service: '车辆维修-上门取车',
						time: '2024-12-06 12:00'
					},
					{
						user: '张先生',
						service: '汽车美容,基础保养',
						time: '2024-12-06 10:00'
					},
					{
						user: '张先生',
						service: '车辆维修-到店维修',
						time: '2024-12-06 10:00'
					},
				],
			}
		},
		methods: {
			navigateToPage(listItem) {
				uni.navigateTo({
					url: listItem.page
				})
			},
			click(name) {
				this.$refs.uToast.success(`点击了第${name}个`)
			},
			goToSmhx() {
				uni.navigateTo({
					url: '/pages/msj/smhx/smhx'
				});
			},
			goToSrhx() {
				uni.navigateTo({
					url: '/pages/msj/srhx/srhx'
				});
			},
		}
	}
</script>

<style scoped>
	.top {
		margin-left: 1%;
		width: 98%;
		height: 200rpx;
		background-image: url(@/static/msj/图层 1.png);
		padding-top: 20rpx;
	}

	.title {
		width: 100%;
		color: #fff;
		font-size: 33rpx;
		text-align: center;
	}

	.user {
		display: flex;
		align-items: center;
		padding: 10rpx;
	}

	.circle-logo {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-right: 20rpx;
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
		overflow: hidden;
		background: #fff;
		box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
	}

	.logo-image {
		width: 100%;
		height: 100%;
	}

	.welcome {
		font-size: 32rpx;
		font-weight: bold;
		color: #fff;
	}

	.subnav {
		margin-left: 2%;
		width: 90%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #fff;
		padding: 20rpx;
		border-radius: 16rpx;
		box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
	}

	.subnav-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		flex: 1;
	}

	.icon-wrapper {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		background: #f2f2f2;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 10rpx;
	}

	.icon {
		width: 48rpx;
		height: 48rpx;
	}

	.text {
		font-size: 28rpx;
		color: #666;
	}

	.divider {
		width: 1rpx;
		height: 60rpx;
		background: #e6e6e6;
	}

	.body {
		margin-top: 160rpx;
		padding: 20rpx;
		width: 90%;
		background: #fff;
	}

	.grid-text {
		font-size: 14px;
		color: #909399;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}

	.grid-item {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.bottom {
		padding: 20rpx;
		width: 90%;
		background: #fff;
		margin-top: 20rpx;
	}


	.bottom {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #fff;
		border-radius: 16rpx;
		box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
	}

	.notification-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20rpx;
	}

	.left {
		display: flex;
		align-items: center;
	}

	.notification-icon {
		width: 40rpx;
		height: 40rpx;
		margin-right: 10rpx;
	}

	.notification-text {
		font-size: 28rpx;
		font-weight: bold;
		color: #333;
	}

	.right {
		display: flex;
		align-items: center;
	}

	.task-text {
		font-size: 28rpx;
		color: #666;
		margin-right: 10rpx;
	}

	.arrow-icon {
		width: 20rpx;
		height: 20rpx;
	}

	.task-table {
		margin-top: 10rpx;
	}

	.table-header {
		display: flex;
		justify-content: space-between;
		padding: 10rpx 0;
		border-bottom: 1rpx solid #e6e6e6;
		font-size: 28rpx;
		color: #333;
	}

	.table-header-item {
		flex: 1;
		text-align: center;
	}

	.table-row {
		display: flex;
		justify-content: space-between;
		padding: 10rpx 0;
		font-size: 24rpx;
		color: #666;
		border-bottom: 1rpx solid #f2f2f2;
	}

	.table-row-item {
		flex: 1;
		text-align: center;
	}
</style>